﻿@* 
Project: Aguafrommars/TheIdServer
Copyright (c) 2022 @Olivier Lefebvre
*@
@using Microsoft.Extensions.Options
@using Aguacongas.TheIdServer.Models
@inject IViewLocalizer Localizer
@inject IOptions<SiteOptions> Options
@{
    string name = null;
    if (!true.Equals(ViewData["signed-out"]))
    {
        name = Context.User?.GetDisplayName();
    }
}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>@Options.Value.Name</title>
    <link rel="icon" type="image/x-icon" href="~/favicon.ico" />
    <link rel="shortcut icon" type="image/x-icon" href="~/favicon.ico" />
    <link rel="stylesheet"
          href="@SiteOptions.BOOTSTRAPCSSURL"
          integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" 
        crossorigin="anonymous" 
        referrerpolicy="no-referrer" /> 
    <link rel="stylesheet" href="~/css/site.min.css" />
    <script src="@SiteOptions.JQUERYURL"
        asp-fallback-src="~/lib/jquery/jquery.min.js"
        asp-fallback-test="window.jQuery"   
        integrity="sha512-6ORWJX/LrnSjBzwefdNUyLCMTIsGoNP6NftMy2UAm1JBm6PRZCO1d7OHBStWpVFZLO+RerTvqX/Z9mBFfCJZ4A==" 
        crossorigin="anonymous" 
        referrerpolicy="no-referrer"></script>
</head>
<body>
    <header>
        <nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
            <div class="container">
                <a class="navbar-brand" href="~/">
                    <span>
                        <img src="~/logo.png" class="icon-banner" alt="logo">
                        @Options.Value.Name
                    </span>
                </a>
                <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
                        aria-expanded="false" aria-label="Toggle navigation">
                    <span class="navbar-toggler-icon"></span>
                </button>
                <div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
                    @if (!string.IsNullOrWhiteSpace(name))
                    {
                        <ul class="nav navbar-nav">
                            <li class="dropdown">
                                <a href="#" class="dropdown-toggle" data-bs-toggle="dropdown">@name <strong class="caret"></strong></a>
                                <ul class="dropdown-menu">
                                    <li class="dropdown-item"><a asp-action="Logout" asp-controller="Account">@Localizer["Logout"]</a></li>
                                </ul>
                            </li>
                        </ul>
                    }
                </div>
            </div>
        </nav>
    </header>

    <div class="container body-content">
        @RenderBody()
    </div>

    @RenderSection("scripts", required: false)
</body>
</html>
